var path = require('path');
var express = require('express');
var app = express(),
    server = require('http').createServer(app),
    // port = 3131 + parseInt(process.env.NODE_APP_INSTANCE),
    port = 3131
    io = require('socket.io')(port);
console.log("port:"+port);
app.use(express.static('public'));
io
  .on('connection', function(socket) {
      socket.on('disconnect', function() {
          console.log('/: disconnect-------->')
      });

      socket.on('b:message', function() {
          socket.emit('s:message', '/: '+port);
          console.log('/: '+port)
      });
  });

// io.of('/ws')
//   .on('connection', function(socket) {
//     socket.on('disconnect', function() {
//         console.log('disconnect-------->')
//     });

//     socket.on('b:message', function() {
//         socket.emit('s:message', port);
//     });
// });

app.get('/abc',function(req,res){
    res.sendFile(path.join(process.cwd(),'./index.html'));
});

server.listen(9090);